﻿@using DirectSell.Model.ManagerNotice
@using Webdiyer.WebControls.Mvc;
@model PagedList<Notices>
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Manager/Views/Shared/ManagerLayout.cshtml";
}

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 公告管理 <span class="c-gray en">&gt;</span> 公告管理 <span class="c-gray en">&gt;</span> 用户管理 
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="#" onclick='$("#searchForm").submit();' title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    @using (Ajax.BeginForm("Index", new RouteValueDictionary { { "id", "" } }, new AjaxOptions { UpdateTargetId = "articles", InsertionMode = InsertionMode.Replace }, new RouteValueDictionary { { "id", "searchForm" } }))
    {
        <div class="text-c">
            日期范围：
            <input type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" id="datemin" name="startTime" class="input-text Wdate" style="width:120px;">
            -
            <input type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })" id="datemax" name="endTime" class="input-text Wdate" style="width:120px;">
            <input type="text" class="input-text" style="width:250px" placeholder="输入关键字" id="" name="SerachCondition">
            <button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜公告</button>
        </div>
    }
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
        <a class="btn btn-primary radius" data-title="添加资讯" data-href="/Manager/NoticeAdd/Index"  href="/Manager/NoticeAdd/Index"><i class="Hui-iconfont">&#xe600;</i> 添加公告</a></span>
     <span class="r">共有数据：<strong>@Model.TotalItemCount</strong> 条</span> </div>
    <div class="mt-20" style="text-align:center">
        <div id="articles">
            @Html.Partial("_AjaxSearchPost", Model)
        </div>
    </div>
</div>
@section Scripts
{
    @{Html.RegisterMvcPagerScriptResource();}
}
<script type="text/javascript">
    /*用户-编辑*/
    function article_edit(title, url, id, w, h) {
        layer_show(title, url, w, h);
    }

    /*用户-查看*/
    function member_show(title, url, id, w, h) {
        layer_show(title, url, w, h);
    }
    //删除公告
    function article_del(id) {
            //询问框
            layer.confirm('删除后不可恢复,确定要删除吗？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                //加载层
                var index = layer.load(1, {
                    shade: [0.1, '#fff']
                });
                $.ajax({
                    type: "post",
                    url: "/Manager/Notice/Del",
                    data: { id: id },
                }).success(function (message) {
                    layer.msg('删除成功', { icon: 1 });
                    $("#searchForm").submit();
                }).fail(function (err) {
                    layer.msg('系统错误,请稍后重试', { icon: 2 });
                })
                layer.close(index)//关闭加载层
            });
    }
    //修改排序
    function UpSort(sort, id) {
        $.ajax({
            type: "post",
            url: "/Manager/Notice/UpdateSort",
            data: { id: id, sort: sort },
        }).success(function (message) {
            layer.msg('修改排序成功', { icon: 6 });
            $("#searchForm").submit();
        }).fail(function (err) {
            layer.msg('系统错误,请稍后重试', { icon: 2 });
        })
    }

</script>
